import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FootprintVO, FootprintForm, FootprintQuery } from '@/api/system/footprint/types';

/**
 * 查询我的足迹列表
 * @param query
 * @returns {*}
 */

export const listFootprint = (query?: FootprintQuery): AxiosPromise<FootprintVO[]> => {
  return request({
    url: '/system/footprint/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询我的足迹详细
 * @param id
 */
export const getFootprint = (id: string | number): AxiosPromise<FootprintVO> => {
  return request({
    url: '/system/footprint/' + id,
    method: 'get'
  });
};

/**
 * 新增我的足迹
 * @param data
 */
export const addFootprint = (data: FootprintForm) => {
  return request({
    url: '/system/footprint',
    method: 'post',
    data: data
  });
};

/**
 * 修改我的足迹
 * @param data
 */
export const updateFootprint = (data: FootprintForm) => {
  return request({
    url: '/system/footprint',
    method: 'put',
    data: data
  });
};

/**
 * 删除我的足迹
 * @param id
 */
export const delFootprint = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/footprint/' + id,
    method: 'delete'
  });
};
